﻿using Common.Prism.Apps;
using NxChatQQ.Models;
using NxChatQQ.Views.Settings;
using Prism.Commands;
using Prism.Regions;
using System.Collections.ObjectModel;
using System.Windows.Input;
using Wpf.Ui.Controls;

namespace NxChatQQ.ViewModels
{
    public class SettingWindowViewModel : BaseViewModel
    {

        private int _SettingListIndex = 0;


        public int SettingListIndex
        {
            get { return _SettingListIndex; }
            set { SetProperty(ref _SettingListIndex, value); }
        }

        public ObservableCollection<NavtabModel> SettingList { get; set; }


        public ICommand SelectionChangedCommand { get; set; }


        public readonly IRegionManager _regionManager;

        public SettingWindowViewModel(IRegionManager regionManager)
        {

            SelectionChangedCommand = new DelegateCommand(SelectionChanged);
            SettingList = new ObservableCollection<NavtabModel>();

            SettingList.Add(new NavtabModel("通用", SymbolRegular.Settings20));
            SettingList.Add(new NavtabModel("消息通知", SymbolRegular.Alert20));
            SettingList.Add(new NavtabModel("存储管理", SymbolRegular.Save20));
            SettingList.Add(new NavtabModel("快捷键", SymbolRegular.Keyboard20));
            SettingList.Add(new NavtabModel("权限设置", SymbolRegular.PersonSettings20));
            SettingList.Add(new NavtabModel("登录设置", SymbolRegular.Cast20));
            SettingList.Add(new NavtabModel("超级调色盘", SymbolRegular.Color20));
            SettingList.Add(new NavtabModel("版本信息", SymbolRegular.Info20));

            _regionManager = regionManager;
            regionManager.RegisterViewWithRegion("SettingContent", typeof(NormalSettingView));
        }



        private void SelectionChanged()
        {

            switch (SettingListIndex)
            {
                case 0:
                    RequestNavigate("NormalSettingView");
                    break;
                case 1:
                    RequestNavigate("NoticeSettingView");
                    break;
                case 2:
                    RequestNavigate("StorageSettingView");
                    break;
                case 3:
                    RequestNavigate("ShortcutSettingView");
                    break;
                case 4:
                    RequestNavigate("VerifySettingView");
                    break;
                case 5:
                    RequestNavigate("LoginSettingView");
                    break;
                case 6:
                    RequestNavigate("ThemeSettingView");
                    break;
                case 7:
                    RequestNavigate("AboutSettingView");
                    break;
                default:
                    break;
            }
        }

        public void RequestNavigate(string viewName)
        {
            _regionManager.RequestNavigate("SettingContent", viewName);
        }

    }
}
